/*
 ============================================================================
 Name        : sysinfo.h
 Author      : ljf
 Version     :
 Copyright   : Your copyright notice
 Description : heard file for sysinfo.c
 History     : 2020/01/17 init versoin
 ============================================================================
 */
#ifndef __SYSINFO_H_
#define __SYSINFO_H_
#include "ljf_util.h"
#define PROC_STAT "/proc/stat"

typedef struct
{
	char name[32];
	unsigned int user;
	unsigned int nice;
	unsigned int system;
	unsigned int idle;
	unsigned int wait;
	unsigned int hardIrq;
	unsigned int softIrq;
	unsigned int steal;
	unsigned int guest;
}cpu_occupy_type;

typedef struct{
	char  cpuName[32];
	float us; /*%us=(User time + Nice time)/Total time*100%*/
	float sy; /*%sy=(System time + Hard Irq time +SoftIRQ time)/Total time*100%*/
	float id; /*%id=(Idle time)/Total time*100%*/
	float ni; /*%ni=(Nice time)/Total time*100%*/
	float wa; /*%wa=(Waiting time)/Total time*100%*/
	float hi; /*%hi=(Hard Irq time)/Total time*100%*/
	float si; /*%si=(SoftIRQ time)/Total time*100%*/
	float st; /*%st=(Steal time)/Total time*100%*/
}cpu_use_type;

typedef struct{
	unsigned long totalram;
	unsigned long freeram;
	unsigned long sharedram;
	unsigned long bufferram;
	float usedRate;
}mem_use_type;

typedef struct{
	unsigned long long diskTotal;
	unsigned long long diskAvail;
	float useRate;
}disk_use_type;

typedef struct{
	char hostname[128];
	cpu_use_type cpu_usage;
	mem_use_type mem_usage;
	disk_use_type disk_use;
}sysInfo_type;

int getCpuUsage(cpu_use_type *cpu_usage);
int getMemInfo(mem_use_type *mem_use);
int getDiskInfo(disk_use_type *disk_use);
#endif
